package cn.yunhe.action;

import java.util.ArrayList;
import java.util.List;

import cn.yunhe.model.Area;
import cn.yunhe.model.Street;
import cn.yunhe.model.Type;
import cn.yunhe.services.HouseServices;
import cn.yunhe.util.BaseAction;
/**
 * 
 * @author Administrator
 *
 */
public class AddHouseAction extends BaseAction {
	
	private List<Type> typeList = new ArrayList<Type>();
	private List<Area> areaList = new ArrayList<Area>();
	private List<Street> streetList = new ArrayList<Street>(); 
	private HouseServices hs = new HouseServices();
	private String areaid;
	/**
	 * 获取住房的类型
	 * @return
	 */
	public String getType(){
		typeList = hs.getAllType();
		return SUCCESS;
	}

	/**
	 * 获取区县
	 * @return
	 */
	public String getArea(){
		areaList = hs.getAllArea();
		return SUCCESS;
	}

	/**
	 * 获取街道
	 * @return
	 */
	public String getStreet(){
		String areaid = getRequest().getParameter("areaid");
		System.out.println(areaid);
		if(areaid!=null && !"".equals(areaid)){
			int aid = Integer.parseInt(areaid);
			streetList = hs.getStreetByAreaId(aid);
			for(Street street : streetList) {
				System.out.println(street.getStreetid());
			}
			return SUCCESS;
		}
		return ERROR;
	}
	
	
	public List<Type> getTypeList() {
		return typeList;
	}
	public void setTypeList(List<Type> typeList) {
		this.typeList = typeList;
	}

	public List<Area> getAreaList() {
		return areaList;
	}

	public void setAreaList(List<Area> areaList) {
		this.areaList = areaList;
	}

	public HouseServices getHs() {
		return hs;
	}

	public void setHs(HouseServices hs) {
		this.hs = hs;
	}

	public List<Street> getStreetList() {
		return streetList;
	}

	public void setStreetList(List<Street> streetList) {
		this.streetList = streetList;
	}

	public String getAreaid() {
		return areaid;
	}

	public void setAreaid(String areaid) {
		this.areaid = areaid;
	}
	
	
}
